# 问题 D: 删数问题
n=int(input())
s=int(input())
lt=list(map(int,str(n)))
length=len(lt)

for i in range(s):
    j=0
    while j<len(lt)-1 and lt[j] <= lt[j+1]:
        j+=1
    lt.pop(j)

lt2=[]
for i in lt:
    lt2.append(str(i))
print(int(''.join(lt2)))
